<template>
  <component :is="componentId" :class="pageClass">
    <template #header v-if="$slots.header">
      <slot name="header"></slot>
    </template>
    <div class="app-page-main">
      <slot></slot>
    </div>
    <div class="app-page-footer">
      <slot name="footer"></slot>
    </div>
  </component>
</template>

<script setup>
const props = defineProps({
  card: { type: Boolean, default: false },
  full: { type: Boolean, default: false },
})

const componentId = computed(() => {
  if (props.card) return 'el-card'

  return 'div'
})

const pageClass = computed(() => {
  let pageClass = {
    'app-page': true,
  }
  if (props.card) pageClass['app-page-card'] = true
  if (props.full) pageClass['app-page-full'] = true

  return pageClass
})
</script>

<style lang="scss" scoped></style>
